﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class TDL03
    {

        public TDL03()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VLAGPL();
            DataContext = MV;
            InitializeComponent();
        }

        public override void LOADBYAUF()
        {
            TBMain.Clear();
            if (ORDERNUM.Length < 12)
                return;
            dwData = TBMain.NewRow();
            dwData["LPMANDANT"] = app.Mandant;
            dwData["LPLO"] = "AND LPLO='" + ORDERNUM.Substring(0, 2) + "'";
            dwData["LPLB"] = "AND LPLB='" + ORDERNUM.Substring(2, 2) + "'";
            dwData["LPPLATZ"] = "AND LPPLATZ ='" + ORDERNUM.Substring(4, 8) + "'";
            SResult = ((VLAGPL)MV).QueryLAGPL(dwData, 5);
            MergeData(SResult, true);
            base.LOADBYAUF();
        }
        public override void OnSave()
        {
            if (!IsSaved)
                return;
            if (dwMaster == null)
                return;
            ((VLAGPL)MV).UpdateLAGPL(dwMaster, app.company, 0);
            string key = KEY;
            KEY = "";
            KEY = key;
            base.OnSave();
        }
    }
}
